package com.dshore.messagecenter.controller.warning;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dshore.messagecenter.log.LogAnnotation;
import com.dshore.messagecenter.model.system.ResponseResult;
import com.dshore.messagecenter.model.system.SysDict;
import com.dshore.messagecenter.model.topicqueue.MdTopic;
import com.dshore.messagecenter.model.warning.MrWarningProcessing;
import com.dshore.messagecenter.service.warning.MrWarningProcessingService;
import com.dshore.messagecenter.util.Page;

/**
 * 预警处理
 * @author Administrator
 *
 */
@Controller
@RequestMapping("/warning")
public class MrWarningProcessingController {
	@Autowired
	private MrWarningProcessingService mrWarningProcessingService;
	
	@RequestMapping("/toWarning")
	public String show() {
		return "warning/mrWarningProcessing";
	}
	
	//获得表格数据
	@RequestMapping(value="/getPage",method=RequestMethod.POST)
	@ResponseBody
	public Page<MrWarningProcessing> getPage(@RequestBody MrWarningProcessing mrWarningProcessing){
		try {
			return mrWarningProcessingService.getPage(mrWarningProcessing);
		}catch (Exception e) {
			return null;
		}
	}
	
	//保存
	@LogAnnotation(methodType="处理",targetType="预警",argsName="alarmItem")
	@RequestMapping(value="/save",method=RequestMethod.POST)
	@ResponseBody
	public ResponseResult<Void> save(MrWarningProcessing mrWarningProcessing) {
		return mrWarningProcessingService.save(mrWarningProcessing);
	}
	
	//获取监控项下拉框的值
	@RequestMapping(value="/getAlarmItem",method=RequestMethod.GET)
	@ResponseBody
	public List<SysDict> getAlarmItem(){
		return mrWarningProcessingService.getAlarmItem();
	}
	
	//获取主题队列下拉框
	@RequestMapping(value="/getTopic",method=RequestMethod.GET)
	@ResponseBody
	public List<MdTopic> getTopic(){
		return mrWarningProcessingService.getTopic();
	}
	
	//获取监控对象类型
	@RequestMapping(value="/getObjType",method=RequestMethod.GET)
	@ResponseBody
	public List<SysDict> getObjType(){
		return mrWarningProcessingService.getObjType();
	}
}
